﻿#include <iostream>
#include <stdio.h>

extern "C" long __stdcall asm_max(long a,long b);  //定义在 ASM_demo.asm
extern "C" long __cdecl C_max(long a,long b);	   //将被汇编程序调用

extern "C" short int N;
extern "C" struct goods   items[];
extern "C" long __stdcall getGoods_1(struct goods *);  //定义在 ASM_demo.asm
extern "C" long __stdcall getGoods_2();  //定义在 ASM_demo.asm

#pragma pack(1)
struct goods {
	char  name[10];		//商品名称
	char  discount;		//折扣
	short int num[5];	//进货价,实际销售价格,进货数量,已售数量,推荐度
};
#pragma pack()

short int N = 5;
struct goods items[] = {
	{'P','E','N',  0,0,0,0,0,0,0, 10,  35,56,70,25,0},
	{'B','O','O','K',0,0,0,0,0,0,  9,  12,30,25, 5,0},
	{  0,  0,  0,  0,0,0,0,0,0,0, 10,  0,  0, 0, 0,0},
	{  0,  0,  0,  0,0,0,0,0,0,0, 10,  0,  0, 0, 0,0},
	{'B','A','G',  0,0,0,0,0,0,0,  8,  10,20,30,10,0},
};

int main()
{
	const char *szMsg = "number = %d \n";
	_asm push 1234
	_asm push szMsg
	_asm call printf
	_asm add esp, 8
	/**/
	long k = asm_max(100L,111L);
	/**/
	getGoods_1(items);
	getGoods_2();
	return 0;
}

long C_max(long a,long b)
{
	return(a>=b? a : b);
}
